package com.authine.cloudpivot.app.openapi.executor;

import com.alibaba.cola.dto.Response;
import com.authine.cloudpivot.app.openapi.domain.Route;
import com.authine.cloudpivot.app.openapi.dto.SaveGatewayRouteCmd;
import org.springframework.stereotype.Component;

/**
 * @author carter
 * create_date  2020/6/5 11:15
 * description     实现保存网关的接口命令
 */
@Component
public class SaveGatewayRouteCmdExe {

    private final Route route;

    public SaveGatewayRouteCmdExe(Route route) {
        this.route = route;
    }

    public Response execute(SaveGatewayRouteCmd cmd) {
        route.updateRoute(cmd.getRoute());
        return Response.buildSuccess();
    }
}
